-
Notifications
You must be signed in to change notification settings - Fork 138
Map AggegateError and Error.cause to ApplicationFailureInfo #1734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- ensureApplicationFailure was not providing Error.cause to ApplicationFailure.create which meant that cause information was not being built - AggegateError.errors wasn't being handled in either ensureApplicationFailure or the DefaultFailureConverter. It is not possible to map that directly to an IFailure, so that information is added to then ApplicationFailureInfo.details field
|
This does what I'm looking for, in that it captures the Error.cause and AggregateError.errors fields, but I don't know that it's perfect.
|
|
Hey @mdouglass! This is a very interesting contribution. Thanks for your work. I will have to think this through and discuss with my colleagues before I take a decision on this PR. |
|
Yeah, I figured this would have some ramifications beyond what I knew. I was hopeful that since end-users were encouraged to use details for their own metadata that it would be relatively safe to (ab)use this way. |
|
The alternative here would be to change the failure type at the protobuf level so that it could accommodate the structure of AggregateError - lots of languages have an error type like this so it’s not unreasonable to do so. That would obviously have even bigger cross-project ramifications so I didn’t want to try it without talking about it first. |
@mjameswh any thoughts/feedback? Not getting complete/accurate error info into the temporal dash is a pain I'd love to put behind me. :) |
|
Just wanted to follow up on this to see if there was any way we could move this forward? |
What was changed
Change how
ensureApplicationFailureand theDefaultFailureConverterhandleError.causeandAggregateError.errors.Why?
ensureApplicationFailurewas not providingError.causetoApplicationFailure.createwhich meant that cause information was not being builtAggegateError.errorswasn't being handled in eitherensureApplicationFailureor theDefaultFailureConverter. It is not possible to map that directly to anIFailure, so that information is added to thenApplicationFailureInfo.detailsfield.Checklist
Closes [Feature Request] support AggregateError #1675
How was this tested:
I was using an activity that looks like this:
Previously, this was all the information available in the Temporal web site for the error:
{ "type": "workflowExecutionFailedEventAttributes", "failure": { "message": "Activity task failed", "cause": { "message": "Scrape workflow quits!", "source": "TypeScriptSDK", "stackTrace": "AggregateError: Scrape workflow quits!\n at getLastScrape (file:///Users/matthew/adology/adology-backend/packages/ad-scraper/src/activities/last-scrape.ts:16:9)", "applicationFailureInfo": { "type": "AggregateError" }, }, "activityFailureInfo": { "scheduledEventId": "5", "startedEventId": "6", "identity": "714@camilla.local", "activityType": { "name": "getLastScrape" }, "activityId": "1", "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED", }, }, "retryState": "RETRY_STATE_RETRY_POLICY_NOT_SET", "workflowTaskCompletedEventId": "10", }After this PR, this is how the failed activity is reported:
{ "type": "workflowExecutionFailedEventAttributes", "failure": { "message": "Activity task failed", "cause": { "message": "Scrape workflow quits!", "source": "TypeScriptSDK", "stackTrace": "AggregateError: Scrape workflow quits!\n at getLastScrape (file:///Users/matthew/adology/adology-backend/packages/ad-scraper/src/activities/last-scrape.ts:16:9)", "cause": { "message": "Scrape workflow is a drama queen x2.", "source": "TypeScriptSDK", "stackTrace": "AggregateError: Scrape workflow is a drama queen x2.\n at getLastScrape (file:///Users/matthew/adology/adology-backend/packages/ad-scraper/src/activities/last-scrape.ts:31:14)", "applicationFailureInfo": { "details": { "payloads": [ [ { "source": "TypeScriptSDK", "message": "Scrape workflow is a drama queen", "stackTrace": "Error: Scrape workflow is a drama queen\n at getLastScrape (file:///Users/matthew/adology/adology-backend/packages/ad-scraper/src/activities/last-scrape.ts:33:11)" }, { "source": "TypeScriptSDK", "message": "Did I mention, scrape workflow is a drama queen?", "stackTrace": "Error: Did I mention, scrape workflow is a drama queen?\n at getLastScrape (file:///Users/matthew/adology/adology-backend/packages/ad-scraper/src/activities/last-scrape.ts:34:11)" } ] ] } } }, "applicationFailureInfo": { "type": "AggregateError", "details": { "payloads": [ { "message": "Analyze workflow gets all the love.", "type": "Error", "stack": "Error: Analyze workflow gets all the love.\n at getLastScrape (file:///Users/matthew/adology/adology-backend/packages/ad-scraper/src/activities/last-scrape.ts:18:7)", "cause": { "message": "Analyze workflow is the money machine.", "type": "Error", "stack": "Error: Analyze workflow is the money machine.\n at getLastScrape (file:///Users/matthew/adology/adology-backend/packages/ad-scraper/src/activities/last-scrape.ts:19:16)" } }, { "message": "Acquire workflow gets all the praise.", "type": "AggregateError", "stack": "AggregateError: Acquire workflow gets all the praise.\n at getLastScrape (file:///Users/matthew/adology/adology-backend/packages/ad-scraper/src/activities/last-scrape.ts:21:7)", "details": [ { "message": "Everyone knows acquire does the hard work", "type": "Error", "stack": "Error: Everyone knows acquire does the hard work\n at getLastScrape (file:///Users/matthew/adology/adology-backend/packages/ad-scraper/src/activities/last-scrape.ts:23:11)" }, { "message": "Everyone can see what acquire does", "type": "Error", "stack": "Error: Everyone can see what acquire does\n at getLastScrape (file:///Users/matthew/adology/adology-backend/packages/ad-scraper/src/activities/last-scrape.ts:24:11)" } ] } ] } } }, "activityFailureInfo": { "scheduledEventId": "5", "startedEventId": "6", "identity": "98241@camilla.local", "activityType": { "name": "getLastScrape" }, "activityId": "1", "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" } }, "retryState": "RETRY_STATE_RETRY_POLICY_NOT_SET", "workflowTaskCompletedEventId": "10" }